<span class="layui-breadcrumb">
                      <a href="/">首页</a>
                      <a href="/demo/">代码生成</a>
                      <a><cite>生成</cite></a>
                    </span>
<div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
        <div class="layui-card">
            <div class="layui-card-header layui-form">
                <div class="layui-inline layui-form-item">
                    <label class="layui-form-label">表名</label>
                    <div class="layui-input-inline">
                        <input type="text" name="tableName" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layuiadmin-btn-list" lay-submit=""
                                lay-filter="LAY-app-contlist-search">
                            <i class="layui-icon layui-icon-search"></i>
                        </button>
                    </div>
                </div>
            </div>
            <div class="layui-card-body">
                <table class="layui-hide" id="genTable" lay-filter="gen"></table>
            </div>
        </div>
    </div>
</div>
<script>
    var tableIns;
    layui.use(["table", "jquery", "form", "laydate", "upload", "element"], function () {//引入layui模块
        var table = layui.table
            , $ = layui.jquery
            , form = layui.form
            , laydate = layui.laydate
            , upload = layui.upload
            , element = layui.element;//初始化
        element.init();
        tableIns = table.render({
            /* 构建员工列表 */
            elem: '#genTable'
            , url: '/gen/list'
            , even: true
            , toolbar: '#toolbarDemo'
            , cols: [[
                {type: 'checkbox', fixed: 'left'}
                , {field: 'tableName', title: '表名'}
                , {field: 'engine', title: '存储引擎'}
                , {field: 'comment', title: '注释'}
                , {field: 'createTime', title: '创建时间'}
            ]]
        });
        //头工具栏事件
        table.on('toolbar(gen)', function(obj){
            var checkStatus = table.checkStatus(obj.config.id);
            switch(obj.event){
                case 'getCheckData':
                    var data = checkStatus.data;
                    var tables=new Array();
                    $.each(data,function (i,n) {
                        tables.push("tableNames="+n.tableName);
                    });
                    window.open("/gen/code?"+tables.join("&"));
                    break;

            };
        });
    });
</script>

<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="getCheckData">代码生成</button>
    </div>
</script>